package main

import "fmt"

const pi float64 = 3.1415926
const zero int = 0

func main() {
	// https://golang.google.cn/dl/
	// https://golang.org/dl

	// https://www.jetbrains.com/go/nextversion
	// 肯 汤普逊 Ken Thompson
	// 罗布 派克 Rob Pike
	// 罗伯特 格里泽默  Robert Griesemer
	// Kubernetes etcd istio prometheus

	fmt.Println("Hello World 2021 Go")

	// 变量
	var hello string  = "你好！ Go"
	fmt.Println(hello)
	hello = "Demo2 你好!!! Go"
	fmt.Println(hello)

	var i2 int = 33
	fmt.Println(i2)
	var f1 float64 = 1.2345
	fmt.Println(f1)
	var i4, i5 = 44, 55
	fmt.Println(i4, "  ", i5)
	var (i6, i7 = 666, 777)
	fmt.Println(i6, "  ", i7)

	fmt.Println(i4 * i5)

	var map1 map[string]string
	fmt.Println("map1:", map1)

	h1 := "hello Go"
	fmt.Println(h1)
	ii1 := 4
	ff1 := 2.234
	pp1 := &ff1
	fmt.Println(ii1, "  ", ff1, "  ", pp1)

	// 常量 支持 boolean string 数字
	fmt.Println(pi)
	fmt.Println(zero)

	// if
	if i4 == 5 {
		fmt.Println(" i4 == 5")
	} else if i4 == 6 {
		fmt.Println(" i4 == 6 ")
	} else {
		fmt.Println(" i4 other")
	}
	// switch

	switch i4 {
	case 4:
		fmt.Println("switch i4 5")
	case 5:
		fmt.Println("switch i4 5")
	default:
		fmt.Println("switch default")

	}

	// for
	for i := 0; i < 10; i++ {
		fmt.Println("i is:", i)
	}

	// 数组
	array1 := [3]int{1, 3, 5}
	fmt.Println("array1:", array1)
	var array2 [3]int = [3]int{}
	fmt.Println("array2: ", array2)
	array3 := [5]int{}
	fmt.Println("array3:", array3)
	array4 := [...]int{1, 3, 5, 7}
	fmt.Println("array4: ", array4)

	// 切片

	// map
	map3 := map[string]int{"demo1": 1, "demo2": 2, "老师": 10}
	fmt.Println("map3: ", map3)

}
